<template>
  <div class="diy-table">
    <el-table :data="tableData" size="mini" :highlight-current-row="true" :stripe="true" style="width: 100%" v-loading="loading">
      <template v-for="item in tableHeader">
        <el-table-column
          v-if="item.prop !== 'handel'"
          :label="item.label"
          width=""
          :prop="item.prop">
        </el-table-column>
        <el-table-column
          v-if="item.prop === 'handel'"
          width="230"
          :label="item.label">
          <template scope="scope">
            <el-button @click="updata(scope.row)" type="text" size="small" class="updata">{{$t('public.edit')}}</el-button>
            <el-button type="text" @click="accessAndroid(scope.row)" size="small" class="updata">{{$t('configLazyLoad.channel.androidIntegrate')}}</el-button>
            <el-button type="text" @click="accessIos(scope.row)" size="small" class="updata">{{$t('configLazyLoad.channel.IOSIntegrate')}}</el-button>
            <el-button type="text" @click="del(scope.row)" size="small" class="del">{{$t('public.delete')}}</el-button>
          </template>
        </el-table-column>
      </template>
    </el-table>
  </div>
</template>
<script>
  import Agent from '@/components/public-modules/cache/Agent'
  export default {
    data () {
      return {
      }
    },
    props: {
      tableData: Array,
      tableHeader: Array,
      loading: {
        type: Boolean,
        default: false
      }
    },
    methods: {
      updata (val) {
        this.$emit('updata', val)
      },
      del (val) {
        this.$emit('del', val)
      },
      accessAndroid (val) {
        this.$emit('accessSdk', { data: val, sdk: 'android' })
      },
      accessIos (val) {
        this.$emit('accessSdk', { data: val, sdk: 'ios' })
      }
    },
    computed: {
    },
    components: {
      Agent
    }
  }
</script>
<style lang="stylus" scoped>
  @import "../../../../../assets/common.styl"
  .diy-table
    .updata
      cursor pointer
    .del
      color $c-pink
      cursor pointer
</style>
